<template>
    <div class="travel-adup-staff">
        <el-dialog
            v-el-drag-dialog="{ drag: true, full: false, resize: false }"
            :visible="true"
            :close-on-click-modal="false"
            @close="closeMd"
            :title="`${obj ? '修改' : '添加'}员工`"
            width="850px">
            <el-form 
                :model="fm.ps" 
                :ref="fm.fname"
                @keyup.enter.native="onSubmit" 
                :label-width="'100px'">
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="员工姓名" required style="margin-bottom: 0px">
                            <div class="flex">
                                <el-form-item
                                    prop="realName"
                                    :rules="[{ required: true, message: '员工姓名不能为空', trigger: 'change' }]">
                                    <el-input
                                        maxlength="10"
                                        v-model="fm.ps.realName" 
                                        placeholder="请输入员工姓名"
                                        style="width: 155px;"
                                    />
                                </el-form-item>
                                
                                <span class="fm-split"></span>

                                <el-form-item
                                    prop="phone"
                                    :rules="[
                                        { required: true, message: '联系电话不能为空', trigger: 'change' },
                                        this.$rules.isPhone('联系电话格式错误')
                                    ]">
                                    <el-input 
                                        maxlength="11" 
                                        v-model="fm.ps.phone" 
                                        placeholder="请输入联系电话"
                                    />
                                </el-form-item>
                            </div>
                        </el-form-item>
                    </el-col>
                    
                    <el-col :span="12">
                        <el-form-item label="入职公司" style="margin-bottom: 0px">
                            <div class="flex">
                                <el-form-item
                                    prop="entryCompany"
                                    :rules="[{ required: false, message: '入职公司不能为空', trigger: 'change' }]">
                                    <el-select
                                        filterable
                                        v-model="fm.ps.entryCompany"
                                        placeholder="请选择入职公司"
                                        style="width: 150px">
                                        <el-option
                                            v-for="item in companyOptions"
                                            :key="item.id"
                                            :label="item.companyName"
                                            :value="item.id">
                                        </el-option>
                                    </el-select>
                                </el-form-item>

                                <span class="fm-split"></span>

                                <el-form-item
                                    prop="staffState"
                                    :rules="[{ required: false, message: '入职状态不能为空', trigger: 'change' }]">
                                    <el-select
                                        v-model="fm.ps.staffState"
                                        placeholder="入职状态">
                                        <el-option label="正式" value="NORMAL"></el-option>
                                        <el-option label="试用" value="TRY"></el-option>
                                        <el-option label="兼职" value="LEAVE"></el-option>
                                    </el-select>
                                </el-form-item>
                            </div>
                        </el-form-item>
                    </el-col>
                </el-row>

                <el-row>
                    <el-col :span="12">
                        <el-form-item label="合同起止" required style="margin-bottom: 0px">
                            <div class="flex">
                                <el-form-item
                                    prop="entryTime"
                                    :rules="[{ required: true, message: '入职日期不能为空', trigger: 'change' }]">
                                    <el-date-picker
                                        style="width: 100%"
                                        v-model="fm.ps.entryTime"
                                        type="date"
                                        value-format="yyyy-MM-dd"
                                        placeholder="选择入职日期"
                                    />
                                </el-form-item>  

                                <span class="fm-split"> ~ </span>

                                <el-form-item
                                    prop="expireTime"
                                    :rules="[{ required: true, message: '合同期限不能为空', trigger: 'change' }]">
                                    <el-date-picker
                                        style="width: 100%"
                                        v-model="fm.ps.expireTime"
                                        type="date"
                                        value-format="yyyy-MM-dd"
                                        placeholder="请选择合同期限"
                                    />
                                </el-form-item>
                            </div>
                        </el-form-item>
                    </el-col>

                    <el-col :span="12">
                        <el-form-item label="部门/角色" required style="margin-bottom: 0px">
                            <div class="flex">
                                <el-form-item
                                    prop="deptId"
                                    :rules="[{ required: true, message: '任职部门不能为空', trigger: 'change' }]">
                                    <SelTeamGroup 
                                        :deptNames="''" 
                                        :isMult="false" 
                                        :isSelAny="true" 
                                        :defval="fm.ps.deptId" 
                                        :width="150" 
                                        @selItem="onChangeDeptId">
                                    </SelTeamGroup>
                                </el-form-item>
                                
                                <span class="fm-split"></span>

                                <el-form-item
                                    prop="roleId"
                                    :rules="[{ required: true, message: '岗位角色不能为空', trigger: 'change' }]">
                                    <el-select
                                        v-model="fm.ps.roleId"
                                        filterable
                                        :disabled="!roleOptions.length"
                                        placeholder="请选择岗位角色"
                                        style="width: 100%">
                                        <el-option
                                            v-for="item in roleOptions"
                                            :key="item.id"
                                            :label="item.name"
                                            :value="item.id"
                                        />
                                    </el-select>
                                </el-form-item>
                            </div>
                        </el-form-item>
                    </el-col>
                </el-row>

                <el-row>
                    <el-col :span="12">
                        <el-form-item label="身份证" style="margin-bottom: 0px">
                            <div class="flex">
                                <el-form-item
                                    prop="idCard"
                                    :rules="[
                                        { required: false, message: '请输入身份证号码', trigger: 'change' },
                                        this.$rules.isIdCard('身份证不合法')
                                    ]">
                                    <el-input
                                        maxlength="18"
                                        v-model="fm.ps.idCard"
                                        placeholder="请输入身份证号码"
                                    />
                                </el-form-item>
                                
                                <span class="fm-split"></span>

                                <el-form-item
                                    prop="idCardExpire"
                                    :rules="[{ required: false, message: '身份证有效期', trigger: 'change' }]">
                                    <el-date-picker
                                        style="width: 140px"
                                        value-format="yyyy-MM-dd"
                                        class="date"
                                        v-model="fm.ps.idCardExpire"
                                        type="date"
                                        placeholder="有效截止日期"
                                    />
                                </el-form-item>
                            </div>
                        </el-form-item>
                    </el-col>
                    
                    <el-col :span="12">
                        <el-form-item label="上传身份证" style="margin-bottom: 0px">
                            <el-col :span="12">
                                <el-form-item
                                    prop="idCardImgFront"
                                    :rules="[{ required: false, message: '身份证(正面)', trigger: 'change' }]">
                                    <UploadImg
                                        class="my-upload-img"
                                        :src="fileBaseUrl+fm.ps.idCardImgFront"
                                        imgName="idCardImgFront"
                                        @getImgUrl="setImgUrl"
                                        :ps="{ userName: uname }"
                                        url="/company/upload"
                                        :icon="'正面照片'"
                                    />
                                </el-form-item>
                            </el-col>

                            <el-col :span="12">
                                <el-form-item
                                    prop="idCardImgBack"
                                    :rules="[{ required: false, message: '身份证(反面)', trigger: 'change' }]">
                                    <UploadImg
                                        class="my-upload-img"
                                        :src="fileBaseUrl+fm.ps.idCardImgBack"
                                        imgName="idCardImgBack"
                                        @getImgUrl="setImgUrl"
                                        url="/company/upload"
                                        :ps="{ userName: uname }"
                                        :icon="'反面照片'"
                                    />
                                </el-form-item>
                            </el-col>
                        </el-form-item>
                    </el-col>
                </el-row>

                <el-row>
                    <el-col :span="12">
                        <el-form-item 
                            label="最高学历" 
                            prop="education">
                            <el-select 
                                v-model="fm.ps.education" 
                                clearable 
                                placeholder="请选择最高学历" 
                                style="width: 100%">
                                <el-option label="小学" value="PRIMARYSCHOOL"></el-option>
                                <el-option label="初中" value="JUNIORSCHOOL"></el-option>
                                <el-option label="高中" value="HIGHSCHOOL"></el-option>
                                <el-option label="专科" value="COLLEGEDEGREE"></el-option>
                                <el-option label="本科" value="BACHELOR"></el-option>
                                <el-option label="硕士" value="MASTER"></el-option>
                                <el-option label="博士" value="DOCTOR"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>

                    <el-col :span="12">
                        <el-form-item 
                            label="上级主管" 
                            prop="upManage">
                            <el-select 
                                clearable 
                                v-model="fm.ps.upManage" 
                                placeholder="请选择上级主管" 
                                style="width: 100%">
                                <el-option 
                                    v-for="item in upManageOptions" 
                                    :key="item.baseUserId.uname" 
                                    :label="item.baseUserId.realName" 
                                    :value="item.baseUserId.uname">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>

                <el-row>
                    <el-col :span="12">
                        <el-form-item label="社保公司" style="margin-bottom: 0px">
                            <div class="flex">
                                <el-form-item
                                    prop="socialUnitChild">
                                    <el-select 
                                        @change="onChangeSocialUnitChild" 
                                        clearable filterable 
                                        v-model="fm.ps.socialUnitChild" 
                                        placeholder="社保公司"
                                        style="width: 100%">
                                        <el-option 
                                            v-for="item in socialUnitChildOptions" 
                                            :key="item.id" 
                                            :label="item.companyName"
                                            :value="item.id">
                                        </el-option>
                                    </el-select>
                                </el-form-item>
                                
                                <span class="fm-split"></span>

                                <el-form-item
                                    prop="socialUnitCustomer">
                                    <el-select 
                                        clearable filterable 
                                        v-model="fm.ps.socialUnitCustomer"
                                        placeholder="挂靠公司" 
                                        style="width: 100%">
                                        <el-option 
                                            v-for="item in socialUnitCustomerOptions" 
                                            :key="item.id" 
                                            :label="item.unitName"
                                            :value="item.id">
                                        </el-option>
                                    </el-select>
                                </el-form-item>
                            </div>
                        </el-form-item>
                    </el-col>

                    <el-col :span="12">
                        <el-form-item label="购买时间" prop="buySocialTime">
                            <el-date-picker
                                style="width: 100%"
                                v-model="fm.ps.buySocialTime"
                                type="date"
                                value-format="yyyy-MM-dd"
                                placeholder="选择开始日期"
                                clearable
                            />
                        </el-form-item>
                    </el-col>
                </el-row>
                
                <el-row>
                    <el-col :span="12">
                        <el-form-item 
                            label="家庭住址" 
                            prop="homePoint.name">
                            <MapPointInp
                                :name="'homePoint'"
                                :placeholder="'请输入搜索家庭住址并选择'"
                                :defList="[]"
                                :defPoint="fm.ps.homePoint"
                                @handleSel="setPoint"
                                style="width: 100%;"
                            />
                        </el-form-item>
                    </el-col>

                    <el-col :span="12">
                        <el-form-item 
                            label="其他备注" 
                            prop="otherNote">
                            <el-input 
                                maxlength="200"
                                type="textarea"
                                clearable
                                show-word-limit 
                                style="width: 100%" 
                                v-model="fm.ps.otherNote" 
                                placeholder="其他备注"
                            />
                        </el-form-item>
                    </el-col>
                </el-row>

                <el-row>
                    <el-col :span="12">
                        <el-form-item 
                            label="账户余额" 
                            prop="lookBtlBalance">
                            <el-radio-group 
                                v-model="fm.ps.lookBtlBalance">
                                <el-radio :label="1">能查看</el-radio>
                                <el-radio :label="0">不能查看</el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>

                    <el-col :span="12">
                        <el-form-item label="其他证件" style="margin-bottom: 0px">
                            <el-col :span="12">
                                <el-form-item
                                    prop="otherPaperUrl1"
                                    :rules="[{ required: false, message: '身份证(正面)', trigger: 'change' }]">
                                    <UploadImg
                                        class="my-upload-img"
                                        :src="fileBaseUrl+fm.ps.otherPaperUrl1"
                                        imgName="otherPaperUrl1"
                                        @getImgUrl="setImgUrl"
                                        :ps="{ userName: uname }"
                                        url="/company/upload"
                                    />
                                </el-form-item>
                            </el-col>

                            <el-col :span="12">
                                <el-form-item
                                    prop="otherPaperUrl2">
                                    <UploadImg
                                        class="my-upload-img"
                                        :src="fileBaseUrl+fm.ps.otherPaperUrl2"
                                        imgName="otherPaperUrl2"
                                        @getImgUrl="setImgUrl"
                                        url="/company/upload"
                                        :ps="{ userName: uname }"
                                    />
                                </el-form-item>
                            </el-col>
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-form>

            <div slot="footer" class="dialog-footer">
                <el-button v-if="obj"
                    type="success" 
                    icon="el-icon-refresh-right" 
                    @click="resetForm">
                    重 置
                </el-button>

                <el-button 
                    type="primary" 
                    :icon="obj ? 'el-icon-edit' : 'el-icon-plus'" 
                    @click="onSubmit" 
                    :loading="fm.sb.load">
                    {{obj ? '修 改' : '添 加'}}
                </el-button>
            </div>
        </el-dialog>
    </div>
</template>

<script>
import { mapGetters } from "vuex";
import elDragDialog from '@/directive/el-drag-dialog';

import MapPointInp from '@/components/MapPointInp';
import UploadImg from "@/components/UploadImg";
import SelTeamGroup from '@/components/SelTeamGroup';

import * as commonSer from '@/api/services/common.service';
import * as logisticsSer from "@/api/services/logistics.service";
import * as personManSer from '@/api/services/travel/person.man.service';

export default {
    name: 'TravelAdupStaff',
    directives: { elDragDialog },
    components: { SelTeamGroup, MapPointInp, UploadImg },
    computed: { ...mapGetters(["uname"]) },
    props: { myData: Object },
    data() {
        return {
            // 文件地址前缀
            fileBaseUrl: this.C.fileBaseUrl,
            // 修改对象数据
            obj: this.myData.obj,

            fm: {// 表单数据对象
                fname: "travelAdupStaffFm",
                sb: { load: false },
                ps: {
                    // 员工id eg:1
                    id: '',       
                    // 姓名 eg:张三
                    realName: '',        
                    // 电话 eg:15888888888     
                    phone: '',                
                    // 身份证号 eg：510723199201290556
                    idCard: '', 
                    // 性别，枚举类型 eg:MALE男 FEMALE女
                    sex: 'MALE',                  
                    // 年龄 eg:20
                    age: '',                  
                    // 实际生日 eg:2020-10-10
                    birthdayTime: '',              
                    // 身份证照片url,逗号拼接 eg:正面url,反面url
                    idCardUrl: '',              
                    // 身份证照片正面
                    idCardImgFront: '',              
                    // 身份证照片反面
                    idCardImgBack: '',          
                    // 身份证到期时间 eg:2020-10-10
                    idCardExpire: '',         
                    // 入职公司id eg:1
                    entryCompany: '',         
                    // 入职状态，枚举类型 eg:NORMAL正式  TRY试用
                    staffState: 'NORMAL',      
                    // 入职时间 eg:2021-09-09     
                    entryTime: '', 
                    // 合同有效期 eg:2022-09-09  
                    expireTime: '',           
                    // 部门id eg：1
                    deptId: [],               
                    // 角色id eg:1
                    roleId: '',               
                    // 学历，枚举类型 eg:小学(PRIMARYSCHOOL) 初中(JUNIORSCHOOL) 高中(HIGHSCHOOL) 专科(COLLEGEDEGREE) 本科(BACHELOR) 硕士(MASTER) 博士(DOCTOR)
                    education: '',            
                    // 上级主管id eg：1
                    upManage: '',             
                    // 是否能查看银行帐余额 0不能查看（默认） 1能查看
                    lookBtlBalance: 0,       
                    // 社保单位子公司id eg：1
                    socialUnitChild: '',      
                    // 社保单位挂靠客户id eg:1
                    socialUnitCustomer: '',   
                    // 购买社保时间 eg:2020-10-10
                    buySocialTime: '',  
                    // 家庭位置
                    homePoint: {
                        // 地址详情 成都市 武侯区 天府广场
                        address: '',        
                        // 地址简称 天府广场
                        name: '',           
                        // 地点坐标 140.xxxxxx,30.xxxxxx
                        lnglat: '',         
                    },                  
                    // 其他备注
                    otherNote: '',            
                    // 其他证件url，多张逗号拼接
                    otherPaperUrl: '',          
                    // 其他证件1
                    otherPaperUrl1: '',          
                    // 其他证件2
                    otherPaperUrl2: '',        
                    // 是否驾驶员，0不是（默认），1是
                    isDriver: '0',             
                }
            },

            // 入职公司列表
            companyOptions: [],
            // 角色列表
            roleOptions: [],
            // 上级主管列表
            upManageOptions: [],
            // 社保公司
            socialUnitChildOptions: [],
            // 挂靠公司
            socialUnitCustomerOptions: [],

        }
    },
    async created() {
        const that = this, ps = that.fm.ps;

        // 入职日期（默认今天）
        ps.entryTime = that.$moment().format("YYYY-MM-DD");
        // 合同到期日期（默认一年）
        ps.expireTime = that.$moment().add(1, 'y').format('YYYY-MM-DD');

        // 获取入职公司
        let res1 = await commonSer.getCompanyDict();
        if(res1.code == 1) {
            that.companyOptions = res1.data;
            if(that.companyOptions.length > 0) ps.entryCompany = that.companyOptions[0].id;
        }

        // 上级主管
        let res2 = await commonSer.getStaffCombo({isContainDriver: 1});
        if(res2.code == 1) that.upManageOptions = res2.data;

        // 社保公司
        let res3 = await commonSer.getCompanyDict();
        if(res3.code == 1) that.socialUnitChildOptions = res3.data; 

        // 挂靠公司
        let res4 = await logisticsSer.getCompanyCusIsDependData({unitNum: that.lunitNum});
        if(res4.code == 1) that.socialUnitCustomerOptions = res4.data;

        // 设置表单默认数据
        that.setInitData();
    },
    methods:{
        closeMd() {
            this.$emit("myClick", {state: false});
        },
        // 部门-下拉框-选择事件
        onChangeDeptId(e){
            const that = this;

            that.U.setFmArr(that.fm.ps.deptId, e.val);
            
            // 获取部门对应角色
            that.getDeptRoleList(that.fm.ps.deptId.join(','));
        },
        // 获取-指定部门角色列表
        getDeptRoleList(id) {
            const that = this;

            that.fm.ps.roleId = '';
            commonSer.getRoleByDeptId({ deptId: id }).then((res) => {
                that.roleOptions = res.data;
            });
        },
        // 图片设置
        setImgUrl(data) {
            this.fm.ps[data.name] = data.url;
        },
        // 社保公司-下拉框-选择事件
        onChangeSocialUnitChild() {
            this.fm.ps.socialUnitCustomer = '';
        },
        // 选择地点后的回调函数
        setPoint(e){
            const that = this, ps = that.fm.ps;

            if(e.p){
                ps.homePoint.address = `${e.p.area.split('-')[1]} ${e.p.name}`;
                ps.homePoint.name = e.p.name;
                ps.homePoint.lnglat = e.p.lnglat;
            }else{
                ps.homePoint.address = '';
                ps.homePoint.name = '';
                ps.homePoint.lnglat = '';
            }
        },

        // 设置初始化数据
        setInitData(){
            const that = this;

            // 设置-修改回填
            if(that.obj) {
                let o = that.obj;
                console.log('修改对象', o);

                // 加载变化列表数据
                if(o.deptId.id) that.onChangeDeptId({val: [o.deptId.id]});

                let ps = {
                    // 员工id eg:1
                    id: o.id,       
                    // 姓名 eg:张三
                    realName: o.baseUserId.realName,        
                    // 电话 eg:15888888888     
                    phone: o.baseUserId.phone,                
                    // 身份证号 eg：510723199201290556
                    idCard: o.idCard || '',                
                    // 身份证照片正面
                    idCardImgFront: o.idCardUrl ? o.idCardUrl.split(',')[0] : '',              
                    // 身份证照片反面
                    idCardImgBack: o.idCardUrl ? o.idCardUrl.split(',')[1] : '',           
                    // 身份证到期时间 eg:2020-10-10
                    idCardExpire: o.idCardExpire || '',         
                    // 入职公司id eg:1
                    entryCompany: o.entryCompany ? o.entryCompany.id : '',         
                    // 入职状态，枚举类型 eg:NORMAL正式  TRY试用
                    staffState: o.staffState,      
                    // 入职时间 eg:2021-09-09     
                    entryTime: o.entryTime, 
                    // 合同有效期 eg:2022-09-09  
                    expireTime: o.expireTime,         
                    // 姓名，枚举类型 eg:MALE男 FEMALE女
                    sex: o.sex || 'MALE',                  
                    // 年龄 eg:20
                    age: o.age || '',                  
                    // 实际生日 eg:2020-10-10
                    birthdayTime: o.birthdayTime || '',         
                    // 部门id eg：1
                    deptId: [o.deptId.id],               
                    // 角色id eg:1
                    roleId: o.roleId.id,               
                    // 学历，枚举类型 eg:小学(PRIMARYSCHOOL) 初中(JUNIORSCHOOL) 高中(HIGHSCHOOL) 专科(COLLEGEDEGREE) 本科(BACHELOR) 硕士(MASTER) 博士(DOCTOR)
                    education: o.education || '',            
                    // 上级主管id eg：1
                    upManage: o.upManage ? o.upManage.id : '',             
                    // 是否能查看银行帐余额 0不能查看（默认） 1能查看
                    lookBtlBalance: o.lookBtlBalance,       
                    // 社保单位子公司id eg：1
                    socialUnitChild: o.socialUnitChild ? o.socialUnitChild.id : '',      
                    // 社保单位挂靠客户id eg:1
                    socialUnitCustomer: o.socialUnitCustomer ? o.socialUnitCustomer.id : '',   
                    // 购买社保时间 eg:2020-10-10
                    buySocialTime: o.buySocialTime || '',  
                    // 家庭位置
                    homePoint: {
                        // 地址详情 成都市 武侯区 天府广场
                        address: o.homeAddress || '',        
                        // 地址简称 天府广场
                        name: o.homeAddress ? o.homeAddress.split(' ')[1] : '',           
                        // 地点坐标 140.xxxxxx,30.xxxxxx
                        lnglat: o.homeLatLon || '',         
                    },             
                    // 其他备注
                    otherNote: o.otherNote || '',          
                    // 其他证件1
                    otherPaperUrl1: o.otherPaperUrl ? o.otherPaperUrl.split(',')[0] : '',          
                    // 其他证件2
                    otherPaperUrl2: o.otherPaperUrl ? o.otherPaperUrl.split(',')[1] : '',      
                    // 是否驾驶员，0不是（默认），1是
                    isDriver: '0',
                };
                that.fm.ps = {...ps};
                console.log('回填的参数对象', that.fm.ps);
            }
        },

        // 重置表单
        resetForm() {
            this.$refs[this.fm.fname].resetFields();
            this.setInitData();
        },
        // 提交表单
        onSubmit() {
            let that = this, U = that.U, fm = that.fm, sb = fm.sb, ps = U.scopy(fm.ps);
            console.log('提交前参数', ps);
            that.$refs[fm.fname].validate((valid) => {
                if (!valid) { return false; } else {
                    let fg = true;

                    // 参数处理
                    if(fg){
                        let idCard = ps.idCard;
                        if(idCard){
                            let obj = U.getIdCardInfo(idCard, '-');
                            if(obj.age) ps.age = obj.age;
                            if(obj.gender) ps.sex = obj.gender == 1 ? 'MALE' : 'FEMALE';
                            if(obj.birthday) ps.birthdayTime = obj.birthday;
                        }
                    }

                    if(fg){
                        let deptId = ps.deptId;
                        if(deptId.length > 0) ps.deptId = ps.deptId.join(',');
                    }

                    if(fg){
                        let arr = [];

                        let idCardImgFront = ps.idCardImgFront;
                        if(idCardImgFront){
                            arr.push(idCardImgFront);
                            delete ps.idCardImgFront;
                        }

                        let idCardImgBack = ps.idCardImgBack;
                        if(idCardImgBack){
                            arr.push(idCardImgBack);
                            delete ps.idCardImgBack;
                        }

                        if(arr.length > 0) ps.idCardUrl = arr.join(',');
                    }

                    if(fg){
                        let arr = [];

                        let otherPaperUrl1 = ps.otherPaperUrl1;
                        if(otherPaperUrl1){
                            arr.push(otherPaperUrl1);
                            delete ps.otherPaperUrl1;
                        }

                        let otherPaperUrl2 = ps.otherPaperUrl2;
                        if(otherPaperUrl2){
                            arr.push(otherPaperUrl2);
                            delete ps.otherPaperUrl2;
                        }

                        if(arr.length > 0) ps.otherPaperUrl = arr.join(',');
                    }

                    if(fg){
                        let homePoint = ps.homePoint;
                        if(homePoint.lnglat){
                            ps.homeAddress = homePoint.address;
                            ps.homeLatLon = homePoint.lnglat;
                            delete ps.homePoint;
                        }
                    }

                    if(fg){
                        console.log('提交后参数', ps);
                        sb.load = true;
                        personManSer.adupStaff(ps).then((res) => {
                            sb.load = false;

                            if (res.code != 1) {
                                U.qerror(res.msg);
                            } else {
                                U.qsuccess(res.msg);

                                // 关闭弹框
                                that.closeMd();

                                // 调用父组件方法-重新加载数据
                                that.$emit("reloadDg");
                            }
                        });

                        setTimeout(() => { sb.load = false; }, 10000);
                    }
                }
            });
        },
        
    },
 }
</script>
